#include "common.h"

bool evaluateTree(TreeNode* root)
{
	if (root->val == 0 || root->val == 1) return root->val;
	if (root->val == 2) return evaluateTree(root->right) | evaluateTree(root->left);
	return evaluateTree(root->right) & evaluateTree(root->left);
}